package demo01;
import java.util.concurrent.atomic.AtomicLong;

public class TimeUnitDemo3 {
    public static void main(String[] args) throws Exception {
        AtomicLong num = new AtomicLong(100L);
//实例化原子操作类
        System.out.println("【原子数据修改】数据修改结果：" +
                num.compareAndSet(100L, 300L));//内容相同,返回true
        System.out.println("【原子数据获取】新的数据内容: " + num.get());//内容为300
    }
}
